2000W / 48V LLC Battery-Charger  V1.00
xmc1_scu.c File Reference
#include <xmc_scu.h>
Include dependency graph for xmc1_scu.c:

Go to the source code of this file.

Macros

#define SCU_IRQ_NUM   (3U)
 SCU low level driver API prototype definition for XMC1 family of microcontrollers
More...
 
#define SCU_GCU_PASSWD_PROT_ENABLE   (195UL)
 
#define SCU_GCU_PASSWD_PROT_DISABLE   (192UL)
 
#define XMC_SCU_CHECK_RTCCLKSRC(source)
 
#define SCU_GENERAL_INTCR_INTSEL_Msk   SCU_GENERAL_INTCR0_INTSEL0_Msk
 
#define SCU_GENERAL_INTCR_INTSEL_Size   SCU_GENERAL_INTCR0_INTSEL1_Pos
 
#define ANA_TSE_T1   (0x10000F30U)
 
#define ANA_TSE_T2   (0x10000F31U)
 
#define DCO_ADJLO_T1   (0x10000F32U)
 
#define DCO_ADJLO_T2   (0x10000F33U)
 
#define XMC_SCU_INTERRUPT_EVENT_MAX   (64U)
 
#define DCO1_DIV2_FREQUENCY_KHZ_Q22_10   (48000U << 10)
 
#define ROM_BmiInstallationReq   (*((uint32_t (**)(uint32_t requestedBmiValue))0x00000108U))
 
#define ROM_CalcTemperature   (*((uint32_t (**)(void))0x0000010cU))
 
#define ROM_CalcTSEVAR   (*((uint32_t (**)(uint32_t temperature))0x00000120U))
 

Functions

static void XMC_SCU_CLOCK_lFrequencyUpScaling (uint32_t curr_idiv, uint32_t idiv)
 
static void XMC_SCU_CLOCK_lFrequencyDownScaling (uint32_t curr_idiv, uint32_t idiv)
 
static uint32_t XMC_SCU_CalcTSEVAR (uint32_t temperature)
 
static void delay (uint32_t cycles)
 
void XMC_SCU_INTERRUPT_EnableEvent (const XMC_SCU_INTERRUPT_EVENT_t event)
 
void XMC_SCU_INTERRUPT_DisableEvent (const XMC_SCU_INTERRUPT_EVENT_t event)
 
void XMC_SCU_INTERRUPT_TriggerEvent (const XMC_SCU_INTERRUPT_EVENT_t event)
 
XMC_SCU_INTERRUPT_EVENT_t XMC_SCU_INTERUPT_GetEventStatus (void)
 
void XMC_SCU_INTERRUPT_ClearEventStatus (const XMC_SCU_INTERRUPT_EVENT_t event)
 
void XMC_SCU_LockProtectedBits (void)
 
void XMC_SCU_UnlockProtectedBits (void)
 
void XMC_SCU_SupplyMonitorInit (const XMC_SCU_SUPPLYMONITOR_t *obj)
 
XMC_SCU_STATUS_t XMC_SCU_SetTempLowLimit (uint32_t limit)
 
XMC_SCU_STATUS_t XMC_SCU_SetTempHighLimit (uint32_t limit)
 
void XMC_SCU_SetRawTempLimits (const uint32_t lower_temp, const uint32_t upper_temp)
 
void XMC_SCU_StartTempMeasurement (void)
 
void XMC_SCU_StopTempMeasurement (void)
 
bool XMC_SCU_HighTemperature (void)
 
bool XMC_SCU_LowTemperature (void)
 
uint32_t XMC_SCU_GetTemperature (void)
 
uint32_t XMC_SCU_CalcTemperature (void)
 
void XMC_SCU_CLOCK_Init (const XMC_SCU_CLOCK_CONFIG_t *const config)
 
void XMC_SCU_CLOCK_SetRtcClockSource (const XMC_SCU_CLOCK_RTCCLKSRC_t source)
 
void XMC_SCU_CLOCK_SetFastPeripheralClockSource (const XMC_SCU_CLOCK_PCLKSRC_t source)
 
void XMC_SCU_CLOCK_GatePeripheralClock (const XMC_SCU_PERIPHERAL_CLOCK_t peripheral)
 
void XMC_SCU_CLOCK_UngatePeripheralClock (const XMC_SCU_PERIPHERAL_CLOCK_t peripheral)
 
bool XMC_SCU_CLOCK_IsPeripheralClockGated (const XMC_SCU_PERIPHERAL_CLOCK_t peripheral)
 
void XMC_SCU_CLOCK_SetMCLKFrequency (uint32_t freq_khz)
 
void XMC_SCU_CLOCK_ScaleMCLKFrequency (uint32_t idiv, uint32_t fdiv)
 
uint32_t XMC_SCU_CLOCK_GetPeripheralClockFrequency (void)
 
uint32_t XMC_SCU_CLOCK_GetFastPeripheralClockFrequency (void)
 
void XMC_SCU_CLOCK_CalibrateOscillatorOnTemperature (int32_t temperature)
 
XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler (XMC_SCU_INTERRUPT_EVENT_t event, XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler)
 
void XMC_SCU_IRQHandler (uint32_t sr_num)
 
uint32_t XMC_SCU_SetBMI (uint32_t flags, uint8_t timeout)
 
void XMC_SCU_CLOCK_EnableDCO1ExtRefCalibration (XMC_SCU_CLOCK_SYNC_CLKSRC_t sync_clk, uint32_t prescaler, uint32_t syn_preload)
 
void XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration (void)
 
bool XMC_SCU_CLOCK_IsDCO1ExtRefCalibrationReady (void)
 
void XMC_SCU_SetInterruptControl (uint8_t irq_number, XMC_SCU_IRQCTRL_t source)
 

Variables

static XMC_SCU_INTERRUPT_EVENT_HANDLER_t event_handler_list [XMC_SCU_INTERRUPT_EVENT_MAX]
 
static XMC_SCU_INTERRUPT_EVENT_t event_masks [SCU_IRQ_NUM]
 

Detailed Description

Date
2017-10-25

Definition in file xmc1_scu.c.

Macro Definition Documentation

◆ ANA_TSE_T1

#define ANA_TSE_T1   (0x10000F30U)

d is a constant data can be retrieved from Flash sector 0 to calculate OFFSET value for DCO calibration

Definition at line 146 of file xmc1_scu.c.

◆ ANA_TSE_T2

#define ANA_TSE_T2   (0x10000F31U)

e is a constant data can be retrieved from Flash sector 0 to calculate OFFSET value for DCO calibration

Definition at line 149 of file xmc1_scu.c.

◆ DCO1_DIV2_FREQUENCY_KHZ_Q22_10

#define DCO1_DIV2_FREQUENCY_KHZ_Q22_10   (48000U << 10)

used to configures main clock (MCLK) frequency to requested frequency value during runtime for XMC14 device.

Definition at line 166 of file xmc1_scu.c.

Referenced by XMC_SCU_CLOCK_UngatePeripheralClock().

◆ DCO_ADJLO_T1

#define DCO_ADJLO_T1   (0x10000F32U)

b is a constant data can be retrieved from Flash sector 0 to calculate OFFSET value for DCO calibration

Definition at line 152 of file xmc1_scu.c.

◆ DCO_ADJLO_T2

#define DCO_ADJLO_T2   (0x10000F33U)

a is a constant data can be retrieved from Flash sector 0 to calculate OFFSET value for DCO calibration

Definition at line 155 of file xmc1_scu.c.

◆ ROM_BmiInstallationReq

#define ROM_BmiInstallationReq   (*((uint32_t (**)(uint32_t requestedBmiValue))0x00000108U))

Pointer to Request BMI installation routine is available inside ROM.

Definition at line 174 of file xmc1_scu.c.

◆ ROM_CalcTemperature

#define ROM_CalcTemperature   (*((uint32_t (**)(void))0x0000010cU))

Pointer to Calculate chip temperature routine is available inside ROM.

Definition at line 179 of file xmc1_scu.c.

Referenced by XMC_SCU_HighTemperature().

◆ ROM_CalcTSEVAR

#define ROM_CalcTSEVAR   (*((uint32_t (**)(uint32_t temperature))0x00000120U))

Pointer to Calculate target level for temperature comparison routine is available inside ROM.

Definition at line 184 of file xmc1_scu.c.

◆ SCU_GCU_PASSWD_PROT_DISABLE

#define SCU_GCU_PASSWD_PROT_DISABLE   (192UL)

Password for disabling protection

Definition at line 118 of file xmc1_scu.c.

◆ SCU_GCU_PASSWD_PROT_ENABLE

#define SCU_GCU_PASSWD_PROT_ENABLE   (195UL)

Password for enabling protection

Definition at line 117 of file xmc1_scu.c.

Referenced by XMC_SCU_INTERUPT_GetEventStatus().

◆ SCU_GENERAL_INTCR_INTSEL_Msk

#define SCU_GENERAL_INTCR_INTSEL_Msk   SCU_GENERAL_INTCR0_INTSEL0_Msk

Mask value of Interrupt Source Select for Node 0

Definition at line 139 of file xmc1_scu.c.

Referenced by XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration().

◆ SCU_GENERAL_INTCR_INTSEL_Size

#define SCU_GENERAL_INTCR_INTSEL_Size   SCU_GENERAL_INTCR0_INTSEL1_Pos

Bit position value of Interrupt Source Select for Node 1

Definition at line 142 of file xmc1_scu.c.

Referenced by XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration().

◆ SCU_IRQ_NUM

#define SCU_IRQ_NUM   (3U)

SCU low level driver API prototype definition for XMC1 family of microcontrollers

Detailed description of file
APIs provided in this file cover the following functional blocks of SCU:
– GCU (APIs prefixed with XMC_SCU_GEN_)
-—Temperature Monitoring, Voltage Monitoring, CCU Start etc

– CCU (APIs prefixed with XMC_SCU_CLOCK_)
-— Clock initialization, Clock Gating, Sleep Management etc

– RCU (APIs prefixed with XMC_SCU_RESET_)
-— Reset Init, Cause, Manual Reset Assert/Deassert etc

– INTERRUPT (APIs prefixed with XMC_SCU_INTERRUPT_)
-— Initialization, Manual Assert/Deassert, Acknowledge etcarray index value for list of events that can generate SCU interrupt

Definition at line 116 of file xmc1_scu.c.

◆ XMC_SCU_CHECK_RTCCLKSRC

#define XMC_SCU_CHECK_RTCCLKSRC (   source)
Value:
( (source == XMC_SCU_CLOCK_RTCCLKSRC_DCO2) || \
(source == XMC_SCU_CLOCK_RTCCLKSRC_ERU_IOUT0) || \
(source == XMC_SCU_CLOCK_RTCCLKSRC_ACMP0_OUT) || \
(source == XMC_SCU_CLOCK_RTCCLKSRC_ACMP1_OUT) || \
(source == XMC_SCU_CLOCK_RTCCLKSRC_ACMP2_OUT) )

Used to verify whether provided RTC clock source is valid or not

Definition at line 121 of file xmc1_scu.c.

◆ XMC_SCU_INTERRUPT_EVENT_MAX

#define XMC_SCU_INTERRUPT_EVENT_MAX   (64U)

Maximum supported SCU events for XMC14 device.

Definition at line 160 of file xmc1_scu.c.

Referenced by XMC_SCU_CLOCK_CalibrateOscillatorOnTemperature().

Function Documentation

◆ delay()

static void delay ( uint32_t  cycles)
static

Definition at line 289 of file xmc1_scu.c.

Referenced by SystemCoreClockSetup().

Here is the caller graph for this function:

◆ XMC_SCU_CalcTemperature()

uint32_t XMC_SCU_CalcTemperature ( void  )

Definition at line 538 of file xmc1_scu.c.

Referenced by L1_Lade_Zusatz_Funktionen_Master(), and L1_Lade_Zusatz_Funktionen_Slave().

Here is the caller graph for this function:

◆ XMC_SCU_CalcTSEVAR()

static uint32_t XMC_SCU_CalcTSEVAR ( uint32_t  temperature)
static

Definition at line 268 of file xmc1_scu.c.

Referenced by XMC_SCU_SetTempLowLimit().

Here is the caller graph for this function:

◆ XMC_SCU_CLOCK_CalibrateOscillatorOnTemperature()

void XMC_SCU_CLOCK_CalibrateOscillatorOnTemperature ( int32_t  temperature)

Definition at line 804 of file xmc1_scu.c.

◆ XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration()

void XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration ( void  )

Definition at line 914 of file xmc1_scu.c.

◆ XMC_SCU_CLOCK_EnableDCO1ExtRefCalibration()

void XMC_SCU_CLOCK_EnableDCO1ExtRefCalibration ( XMC_SCU_CLOCK_SYNC_CLKSRC_t  sync_clk,
uint32_t  prescaler,
uint32_t  syn_preload 
)

Definition at line 900 of file xmc1_scu.c.

◆ XMC_SCU_CLOCK_GetFastPeripheralClockFrequency()

uint32_t XMC_SCU_CLOCK_GetFastPeripheralClockFrequency ( void  )

Definition at line 798 of file xmc1_scu.c.

◆ XMC_SCU_CLOCK_IsDCO1ExtRefCalibrationReady()

bool XMC_SCU_CLOCK_IsDCO1ExtRefCalibrationReady ( void  )

Definition at line 923 of file xmc1_scu.c.

◆ XMC_SCU_CLOCK_lFrequencyDownScaling()

static void XMC_SCU_CLOCK_lFrequencyDownScaling ( uint32_t  curr_idiv,
uint32_t  idiv 
)
static

Definition at line 768 of file xmc1_scu.c.

◆ XMC_SCU_CLOCK_lFrequencyUpScaling()

static void XMC_SCU_CLOCK_lFrequencyUpScaling ( uint32_t  curr_idiv,
uint32_t  idiv 
)
static

Definition at line 750 of file xmc1_scu.c.

◆ XMC_SCU_CLOCK_ScaleMCLKFrequency()

void XMC_SCU_CLOCK_ScaleMCLKFrequency ( uint32_t  idiv,
uint32_t  fdiv 
)

Definition at line 696 of file xmc1_scu.c.

◆ XMC_SCU_CLOCK_SetFastPeripheralClockSource()

void XMC_SCU_CLOCK_SetFastPeripheralClockSource ( const XMC_SCU_CLOCK_PCLKSRC_t  source)

Definition at line 617 of file xmc1_scu.c.

Here is the call graph for this function:

◆ XMC_SCU_CLOCK_SetMCLKFrequency()

void XMC_SCU_CLOCK_SetMCLKFrequency ( uint32_t  freq_khz)

Definition at line 654 of file xmc1_scu.c.

◆ XMC_SCU_CLOCK_SetRtcClockSource()

void XMC_SCU_CLOCK_SetRtcClockSource ( const XMC_SCU_CLOCK_RTCCLKSRC_t  source)

Definition at line 604 of file xmc1_scu.c.

◆ XMC_SCU_GetTemperature()

uint32_t XMC_SCU_GetTemperature ( void  )

Definition at line 528 of file xmc1_scu.c.

Referenced by L1_Lade_Zusatz_Funktionen_Master(), and L1_Lade_Zusatz_Funktionen_Slave().

Here is the caller graph for this function:

◆ XMC_SCU_HighTemperature()

bool XMC_SCU_HighTemperature ( void  )

Definition at line 516 of file xmc1_scu.c.

◆ XMC_SCU_LockProtectedBits()

void XMC_SCU_LockProtectedBits ( void  )

Definition at line 406 of file xmc1_scu.c.

Referenced by XMC_SCU_CLOCK_SetFastPeripheralClockSource().

Here is the caller graph for this function:

◆ XMC_SCU_LowTemperature()

bool XMC_SCU_LowTemperature ( void  )

Definition at line 522 of file xmc1_scu.c.

◆ XMC_SCU_SetBMI()

uint32_t XMC_SCU_SetBMI ( uint32_t  flags,
uint8_t  timeout 
)

Definition at line 889 of file xmc1_scu.c.

Referenced by L0_BMI_Config().

Here is the caller graph for this function:

◆ XMC_SCU_SetInterruptControl()

void XMC_SCU_SetInterruptControl ( uint8_t  irq_number,
XMC_SCU_IRQCTRL_t  source 
)

Definition at line 929 of file xmc1_scu.c.

◆ XMC_SCU_SetRawTempLimits()

void XMC_SCU_SetRawTempLimits ( const uint32_t  lower_temp,
const uint32_t  upper_temp 
)

Definition at line 497 of file xmc1_scu.c.

◆ XMC_SCU_SetTempHighLimit()

XMC_SCU_STATUS_t XMC_SCU_SetTempHighLimit ( uint32_t  limit)

Definition at line 478 of file xmc1_scu.c.

◆ XMC_SCU_SetTempLowLimit()

XMC_SCU_STATUS_t XMC_SCU_SetTempLowLimit ( uint32_t  limit)

Definition at line 459 of file xmc1_scu.c.

Here is the call graph for this function:

◆ XMC_SCU_StartTempMeasurement()

void XMC_SCU_StartTempMeasurement ( void  )

Definition at line 504 of file xmc1_scu.c.

Referenced by L0_ADC_Config().

Here is the caller graph for this function:

◆ XMC_SCU_StopTempMeasurement()

void XMC_SCU_StopTempMeasurement ( void  )

Definition at line 510 of file xmc1_scu.c.

◆ XMC_SCU_SupplyMonitorInit()

void XMC_SCU_SupplyMonitorInit ( const XMC_SCU_SUPPLYMONITOR_t *  obj)

Definition at line 423 of file xmc1_scu.c.

◆ XMC_SCU_UnlockProtectedBits()

void XMC_SCU_UnlockProtectedBits ( void  )

Definition at line 412 of file xmc1_scu.c.

Referenced by XMC_SCU_CLOCK_SetFastPeripheralClockSource().

Here is the caller graph for this function:

Variable Documentation

◆ event_handler_list

For registering callback functions on SCU event occurrence.

Definition at line 192 of file xmc1_scu.c.

Referenced by XMC_SCU_INTERRUPT_SetEventHandler().

◆ event_masks

XMC_SCU_INTERRUPT_EVENT_t event_masks[SCU_IRQ_NUM]
static

Defines list of events that can generate SCU interrupt and also indicates SCU events mapping to corresponding service request number. These event mask values can be used to verify which event is triggered that corresponds to service request number during runtime. All the event items are tabulated as per service request sources list table of SCU.

Definition at line 196 of file xmc1_scu.c.